package org.example03.mapper;

import org.apache.ibatis.annotations.*;
import org.apache.ibatis.mapping.FetchType;
import org.example03.po.Order;
import org.example03.po.User;

import java.util.List;

public interface OrderMapper {
    @Results({
            @Result(column = "user_id", property = "userId"),
            @Result(property = "orderDetails",javaType = List.class,column = "id",
            many = @Many(select = "org.example03.mapper.OrderDetailMapper.getOrderDetailByOrderId",fetchType = FetchType.LAZY))
    })
    @Select("select * from mybatis02.order where user_id = #{userId}")
    List<Order> getOrderByUserId();
}

